
grails {
	plugin {

		springsecurity {
			rest{
				token {
					validation {
						useBearerToken = false
						headerName = 'Access-Token'
					}
					storage {
						jwt {
							expiration = 3600
							secret = "WT secret must be defined. Please provide a value for the config property: grails.plugin.springsecurity.conf.rest.token.storage.jwt.secret"
						}
					}
				}
				login {
					useJsonCredentials = true
					useRequestParamsCredentials = false
				}
			}

			//	useSecurityEventListener = true

			fii {
				rejectPublicInvocations = false
			}

			rejectIfNoRule = false

		}

	}
}

// Added by the Spring Security Core plugin:
grails.plugin.springsecurity.userLookup.userDomainClassName = 'cn.qs.qatool.User'
grails.plugin.springsecurity.userLookup.authorityJoinClassName = 'cn.qs.qatool.UserRole'
grails.plugin.springsecurity.authority.className = 'cn.qs.qatool.Role'
grails.plugin.springsecurity.controllerAnnotations.staticRules = [
	[pattern: '/error',          access: ['permitAll']],
	[pattern: '/index',          access: ['permitAll']],
	[pattern: '/index.gsp',      access: ['permitAll']],
	[pattern: '/shutdown',       access: ['permitAll']],
	[pattern: '/assets/**',      access: ['permitAll']],
	[pattern: '/**/js/**',       access: ['permitAll']],
	[pattern: '/**/css/**',      access: ['permitAll']],
	[pattern: '/**/images/**',   access: ['permitAll']],
	[pattern: '/**/favicon.ico', access: ['permitAll']],
	[pattern: '/**', 			 access: ['ROLE_USER']]
]

grails.plugin.springsecurity.filterChain.chainMap = [
	[pattern: '/assets/**',      filters: 'none'],
	[pattern: '/**/js/**',       filters: 'none'],
	[pattern: '/**/css/**',      filters: 'none'],
	[pattern: '/**/images/**',   filters: 'none'],
	[pattern: '/**/favicon.ico', filters: 'none'],
	[pattern: '/**',    		 filters: 'JOINED_FILTERS,-anonymousAuthenticationFilter,-exceptionTranslationFilter,-authenticationProcessingFilter,-securityContextPersistenceFilter,-rememberMeAuthenticationFilter']
]

